//
//  TouZiPersonXQ.m
//  投融保
//
//  Created by admin on 14-1-7.
//  Copyright (c) 2014年 木叶科技. All rights reserved.
//

#import "TouZiPersonXQ.h"
#import "MYWebService.h"
@interface TouZiPersonXQ ()<MBProgressHUDDelegate>{

    NSDictionary *touZiPersonArray;
    MBProgressHUD *mbHud;
}

@end

@implementation TouZiPersonXQ
extern NSString *key;
extern NSString *userBaseId;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    //    //客户记录详情
    //    NSString *strappInvestorInfoService=@"service=appInvestorInfoService&userBaseId=20131009101728042553";
    
    
    // ------异步加载数据
    if (touZiPersonArray==nil) {
        
        mbHud = [[MBProgressHUD alloc] initWithView:self.view];
        mbHud.labelText = @"正在加载";
        [self.view addSubview:mbHud];
        mbHud.delegate = self;
        [mbHud show:YES];
    
        NSString *strappInvestorInfoService=[NSString stringWithFormat:@"service=appInvestorInfoService&userBaseId=%@",userBaseId];
        [[MYWebService new]getDataAsynWithKey:key encryptedString:strappInvestorInfoService appKey:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getdata:)   name:@"getAsyData" object:nil];
    }

}

-(void)getdata:(NSNotification *)asyData{
    if (asyData!=nil) {
        
        touZiPersonArray = [NSDictionary new];
        sleep(2);
        
        touZiPersonArray = [[[asyData object] objectForKey:@"dataMap"] objectForKey:@"info"];
        self.nameLable.text = [touZiPersonArray objectForKey:@"userName"];
        if (![[touZiPersonArray objectForKey:@"realName"] isEqual:[NSNull null]]) {
            self.relaName.text = [touZiPersonArray objectForKey:@"realName"];
        }
        
        self.phoneName.text = [NSString stringWithFormat:@"%@",[touZiPersonArray objectForKey:@"mobile"]];
        if ([touZiPersonArray objectForKey:@"state"]!=nil) {
       
        if ([[touZiPersonArray objectForKey:@"state"]isEqualToString:@"normal"]) {
            self.renZhengLable.text=@"认证";

        }else{
        
            self.renZhengLable.text=@"未认证";

        }
        }
        [mbHud removeFromSuperview];
        mbHud = nil;
        
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        
    }else{
        [mbHud removeFromSuperview];
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        
    }
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)backClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
//    [self dismissModalViewControllerAnimated:YES];
}
#pragma mark-   -----------状态栏底色------
- (UIStatusBarStyle)preferredStatusBarStyle
{
    [self.view setBackgroundColor:[UIColor blackColor]];
    return UIStatusBarStyleLightContent;
}
- (BOOL)prefersStatusBarHidden
{
    return NO;
}
@end
